package com.edu.neusoft.student.exception;

import com.edu.neusoft.student.util.AjaxResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class MyGlobalExceptionHandler {
    @ExceptionHandler(MethodArgumentNotValidException.class)
    public AjaxResult handleValidationExceptions( MethodArgumentNotValidException ex) {
        return AjaxResult.error("参数校验失败："+ ex.getMessage());
    }
}